Quiz 5
We'll cover the following
Question # 1#
Is there a difference in the results of the following WHERE clauses?
WHERE myColumn = NULL
vs.
WHERE myColumn IS NULL
NULL is treated as a special value. It is used as a placeholder for unknown or inapplicable values and can’t be used with comparison operators such as =, >, <, <>. Therefore the two WHERE clauses aren’t equal. NULL should always be tested for using IS NULL or IS NOT NULL.
Question # 2
What will be the outcome of the below query? Assume, SomeTable exists.
SELECT "Hello"
FROM SomeTable
WHERE NULL = NULL;
A)
“Hello” will be printed.
B)
Nothing will be printed.
C)
Syntax error, NULL can’t be used on the right hand side of the = operator.
Question # 3
Can a table have multiple clustered indexes?
A)
Yes
B)
No
Question # 4
Which one of the following is a disadvantage of adding a foreign key constraint?
A)
Foreign key constraint is never a disadvantage as it ensures data integrity.
B)
Adding a foreign slows down write queries as the database has to verify that each write operation honors the foreign key constraint.
C)
Foreign keys can slow down an index.
Question # 5
Under what condition does REPLACE behave exactly like INSERT?
A)
When there’s is a foreign key defined on a table
B)
When table has a single column
C)
When the table has no primary and unique index defined on it